﻿using System;
using System.ComponentModel;
using System.Xml.Serialization;

namespace Microsoft.WowAddonStudio.FrameXml.Serialization.LayoutFrames
{
    [Serializable]
    [DesignerCategory("code")]
    [XmlType(Namespace = "http://www.blizzard.com/wow/ui/")]
    [XmlRoot(Namespace = "http://www.blizzard.com/wow/ui/", IsNullable = false)]
    public class SimpleHTML : Frame
    {
        /// <summary>
        /// Gets or sets the <see cref="FontString"/> used for default text.
        /// </summary>
        [XmlElement]
        [Category("Appearance")]
        [Description("The font used to display the default text.")]
        public FontString FontString
        {
            get { return Properties.GetValue<FontString>("FontString"); }
            set { Properties.SetValue("FontString", value); }
        }

        /// <summary>
        /// Gets or sets the <see cref="FontString"/> used for H1 text.
        /// </summary>
        [XmlElement]
        [Description("The font used to display the H1 text.")]
        public FontString FontStringHeader1
        {
            get { return Properties.GetValue<FontString>("FontStringHeader1"); }
            set { Properties.SetValue("FontStringHeader1", value); }
        }

        /// <summary>
        /// Gets or sets the <see cref="FontString"/> used for H2 text.
        /// </summary>
        [XmlElement]
        [Description("The font used to display the H2 text.")]
        public FontString FontStringHeader2
        {
            get { return Properties.GetValue<FontString>("FontStringHeader2"); }
            set { Properties.SetValue("FontStringHeader2", value); }
        }

        /// <summary>
        /// Gets or sets the <see cref="FontString"/> used for H3 text.
        /// </summary>
        [XmlElement]
        [Description("The font used to display the H3 text.")]
        public FontString FontStringHeader3
        {
            get { return Properties.GetValue<FontString>("FontStringHeader3"); }
            set { Properties.SetValue("FontStringHeader3", value); }
        }

        /// <summary>
        /// Gets or sets the font used for the HTML.
        /// </summary>
        [XmlAttribute("font")]
        [Category("Appearance")]
        [Description("The font used to display the HTML.")]
        public string Font
        {
            get { return Properties.GetValue<string>("Font"); }
            set { Properties.SetValue("Font", value); }
        }

        /// <summary>
        /// Gets or sets the HTML file.
        /// </summary>
        [XmlAttribute("file")]
        [Category("Appearance")]
        [Description("This refers to a file used by element, path is relative to scheme path: if addon is in \"MyAddon\" folder file specified \"myfile.lua\" will be searched in this folder (i guess only, needs testing). \"\\Interface\\Wherever\" seems to be the same as \"Interface\\Wherever\" (\"C:\\{{WoW}}\\Interface\\Wherever\").")]
        public string File
        {
            get { return Properties.GetValue<string>("File"); }
            set { Properties.SetValue("File", value); }
        }

        /// <summary>
        /// Gets or sets the format of the hyperlink. The default value is '|H%s|h%s|h'.
        /// </summary>
        [XmlAttribute("hyperlinkFormat")]
        [DefaultValue("|H%s|h%s|h")]
        [Category("Appearance")]
        [Description("Defines the format of the hyperlink. The default value is '|H%s|h%s|h'.")]
        public string HyperLinkFormat
        {
            get { return Properties.GetValue<string>("HyperLinkFormat"); }
            set { Properties.SetValue("HyperLinkFormat", value); }
        }

        /// <summary>
        /// Gets a value indicating whether a serialization object is complete and can be rendered.
        /// </summary>
        public override bool IsComplete
        {
            get
            {
                return FontString != null;
            }
        }
    }
}